import requests
import re

# 设置请求参数
hd= {
  "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
} 
ps={"wd":"python"}
url = "https://www.baidu.com/s"

page = requests.get(url=url ,headers=hd ,params=ps)

# print(page.text)
pat = '<h3 class="t uJMbyI lwFvu_">.*?<a .*?>(.*?)</a>.*?</h3>'
res = re.compile(pat,re.S).findall(page.text)
print(page.status_code )
print(len(page.text))
print(len(res))
for e in res :
  print(e)